﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using DTO;
using BUS;

public partial class KetQuaTimKiemLapTopNangCao : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string hangsanxuat = Request.QueryString[0];
            string thongtincpu = Request.QueryString[1];
            string tocdocputu = Request.QueryString[2];
            string tocdocpuden = Request.QueryString[3];
            string kichthuocmanhinh = Request.QueryString[4];
            string dungluongvgatu = Request.QueryString[5];
            string dungluongvgaden = Request.QueryString[6];
            string dungluongramtu = Request.QueryString[7];
            string dungluongramden = Request.QueryString[8];
            string dungluonghddtu = Request.QueryString[9];
            string dungluonghddden = Request.QueryString[10];
            string dungluongpin = Request.QueryString[11];
            string thongtinhedieuhanh = Request.QueryString[12];
            string trongluongmaytu = Request.QueryString[13];
            string trongluongmayden = Request.QueryString[14];
            if (TimKiemLapTopNangCao(hangsanxuat, thongtincpu, tocdocputu, tocdocpuden,
            kichthuocmanhinh, dungluongvgatu, dungluongvgaden, dungluongramtu, dungluongramden, dungluonghddtu, dungluonghddden,
            dungluongpin, thongtinhedieuhanh, trongluongmaytu, trongluongmayden)== false)
            {
                lbThongBaoKetQuaTimKiem.Text = "Không có sản phẩm tìm kiếm tương ứng";
                lbThongBaoKetQuaTimKiem.Visible = true;
            }

        }
    }

    private bool TimKiemLapTopNangCao(string hangsanxuat, string thongtincpu, string tocdocputu,
        string tocdocpuden, string kichthuocmanhinh, string dungluongvgatu, string dungluongvgaden,
        string dungluongramtu, string dungluongramden, string dungluonghddtu, string dungluonghddden,
        string dungluongpin, string thongtinhedieuhanh, string trongluongmaytu, string trongluongmayden)
    {
        List<SanPhamDTO> result = ChiTietLapTopBUS.TimKiemLapTopNangCao(hangsanxuat, thongtincpu, tocdocputu, tocdocpuden,
            kichthuocmanhinh, dungluongvgatu, dungluongvgaden, dungluongramtu, dungluongramden, dungluonghddtu, dungluonghddden,
            dungluongpin, thongtinhedieuhanh, trongluongmaytu, trongluongmayden);
        if (result.Count > 0)
        {
            CollectionPager3.PageSize = 9;
            CollectionPager3.DataSource = result;
            CollectionPager3.BindToControl = dtlKetQuaTimKiem;
            dtlKetQuaTimKiem.DataSource = CollectionPager3.DataSourcePaged;
            return true;
        }
        return false;
    }
}
